type token =
  | PLUS
  | MINUS
  | TIMES
  | DIVIDE
  | FPLUS
  | FMINUS
  | FTIMES
  | FDIVIDE
  | ASSIGN
  | LPAREN
  | RPAREN
  | LBRACE
  | RBRACE
  | COMMA
  | SEMI
  | INT
  | STRINGV
  | DQUOTATION
  | SQUOTATION
  | LSQUA
  | RSQUA
  | PERIOD
  | RETURN
  | FLO
  | EOF
  | LITERAL of (int)
  | FLOAT of (float)
  | ID of (string)
  | STR of (string)
  | CHAR of (char)

open Parsing;;
# 1 "parser.mly"
 open Ast 
# 37 "parser.ml"
let yytransl_const = [|
  257 (* PLUS *);
  258 (* MINUS *);
  259 (* TIMES *);
  260 (* DIVIDE *);
  261 (* FPLUS *);
  262 (* FMINUS *);
  263 (* FTIMES *);
  264 (* FDIVIDE *);
  265 (* ASSIGN *);
  266 (* LPAREN *);
  267 (* RPAREN *);
  268 (* LBRACE *);
  269 (* RBRACE *);
  270 (* COMMA *);
  271 (* SEMI *);
  272 (* INT *);
  273 (* STRINGV *);
  274 (* DQUOTATION *);
  275 (* SQUOTATION *);
  276 (* LSQUA *);
  277 (* RSQUA *);
  278 (* PERIOD *);
  279 (* RETURN *);
  280 (* FLO *);
    0 (* EOF *);
    0|]

let yytransl_block = [|
  281 (* LITERAL *);
  282 (* FLOAT *);
  283 (* ID *);
  284 (* STR *);
  285 (* CHAR *);
    0|]

let yylhs = "\255\255\
\002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
\002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
\002\000\002\000\002\000\002\000\002\000\003\000\003\000\001\000\
\001\000\004\000\007\000\007\000\008\000\008\000\009\000\009\000\
\009\000\006\000\006\000\010\000\010\000\005\000\005\000\000\000"

let yylen = "\002\000\
\005\000\005\000\005\000\005\000\005\000\005\000\005\000\005\000\
\001\000\001\000\001\000\001\000\001\000\004\000\002\000\002\000\
\002\000\003\000\005\000\006\000\002\000\002\000\003\000\000\000\
\002\000\007\000\000\000\001\000\001\000\003\000\002\000\002\000\
\002\000\000\000\002\000\001\000\003\000\000\000\001\000\002\000"

let yydefred = "\000\000\
\024\000\000\000\000\000\000\000\025\000\000\000\000\000\000\000\
\000\000\000\000\000\000\029\000\031\000\032\000\033\000\000\000\
\000\000\034\000\030\000\000\000\000\000\034\000\026\000\000\000\
\000\000\000\000\000\000\009\000\010\000\000\000\013\000\012\000\
\000\000\035\000\000\000\000\000\000\000\017\000\021\000\016\000\
\000\000\000\000\000\000\022\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\023\000\000\000\018\000\036\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\014\000\000\000\000\000\001\000\
\002\000\003\000\004\000\005\000\006\000\007\000\008\000\019\000\
\037\000\000\000\020\000"

let yydgoto = "\002\000\
\003\000\033\000\034\000\005\000\057\000\020\000\010\000\011\000\
\012\000\058\000"

let yysindex = "\001\000\
\000\000\000\000\230\254\249\254\000\000\017\255\233\254\237\254\
\247\254\021\255\022\255\000\000\000\000\000\000\000\000\023\255\
\017\255\000\000\000\000\027\255\067\255\000\000\000\000\011\255\
\015\255\067\255\018\255\000\000\000\000\253\254\000\000\000\000\
\031\255\000\000\111\255\047\255\028\255\000\000\000\000\000\000\
\067\255\067\255\033\255\000\000\067\255\067\255\067\255\067\255\
\067\255\067\255\067\255\067\255\000\000\037\255\000\000\000\000\
\036\255\051\255\045\255\056\255\057\255\058\255\068\255\069\255\
\070\255\071\255\074\255\065\255\000\000\067\255\078\255\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\067\255\000\000"

let yyrindex = "\000\000\
\000\000\000\000\078\000\000\000\000\000\077\255\000\000\000\000\
\000\000\000\000\094\255\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\008\255\000\000\000\000\
\000\000\000\000\000\000\000\000\096\255\000\000\000\000\000\000\
\000\000\095\255\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\097\255\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000"

let yygindex = "\000\000\
\000\000\235\255\000\000\000\000\000\000\067\000\000\000\000\000\
\092\000\000\000"

let yytablesize = 119
let yytable = "\035\000\
\004\000\001\000\006\000\013\000\039\000\041\000\042\000\014\000\
\011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
\043\000\015\000\011\000\055\000\056\000\011\000\011\000\060\000\
\061\000\062\000\063\000\064\000\065\000\066\000\067\000\016\000\
\007\000\008\000\018\000\017\000\021\000\037\000\022\000\023\000\
\009\000\038\000\024\000\025\000\040\000\044\000\069\000\054\000\
\081\000\026\000\027\000\028\000\029\000\030\000\031\000\032\000\
\021\000\059\000\022\000\053\000\083\000\068\000\024\000\025\000\
\070\000\071\000\072\000\073\000\074\000\026\000\027\000\028\000\
\029\000\030\000\031\000\032\000\021\000\040\000\075\000\076\000\
\077\000\078\000\024\000\025\000\079\000\080\000\082\000\027\000\
\036\000\026\000\027\000\028\000\029\000\030\000\031\000\032\000\
\015\000\015\000\015\000\015\000\015\000\015\000\015\000\015\000\
\028\000\038\000\015\000\039\000\019\000\015\000\015\000\045\000\
\046\000\047\000\048\000\049\000\050\000\051\000\052\000"

let yycheck = "\021\000\
\027\001\001\000\010\001\027\001\026\000\009\001\010\001\027\001\
\001\001\002\001\003\001\004\001\005\001\006\001\007\001\008\001\
\020\001\027\001\011\001\041\000\042\000\014\001\015\001\045\000\
\046\000\047\000\048\000\049\000\050\000\051\000\052\000\011\001\
\016\001\017\001\012\001\014\001\010\001\027\001\012\001\013\001\
\024\001\027\001\016\001\017\001\027\001\015\001\011\001\020\001\
\070\000\023\001\024\001\025\001\026\001\027\001\028\001\029\001\
\010\001\025\001\012\001\013\001\082\000\025\001\016\001\017\001\
\014\001\021\001\011\001\011\001\011\001\023\001\024\001\025\001\
\026\001\027\001\028\001\029\001\010\001\000\000\011\001\011\001\
\011\001\011\001\016\001\017\001\011\001\021\001\009\001\011\001\
\022\000\023\001\024\001\025\001\026\001\027\001\028\001\029\001\
\001\001\002\001\003\001\004\001\005\001\006\001\007\001\008\001\
\011\001\011\001\011\001\011\001\017\000\014\001\015\001\001\001\
\002\001\003\001\004\001\005\001\006\001\007\001\008\001"

let yynames_const = "\
  PLUS\000\
  MINUS\000\
  TIMES\000\
  DIVIDE\000\
  FPLUS\000\
  FMINUS\000\
  FTIMES\000\
  FDIVIDE\000\
  ASSIGN\000\
  LPAREN\000\
  RPAREN\000\
  LBRACE\000\
  RBRACE\000\
  COMMA\000\
  SEMI\000\
  INT\000\
  STRINGV\000\
  DQUOTATION\000\
  SQUOTATION\000\
  LSQUA\000\
  RSQUA\000\
  PERIOD\000\
  RETURN\000\
  FLO\000\
  EOF\000\
  "

let yynames_block = "\
  LITERAL\000\
  FLOAT\000\
  ID\000\
  STR\000\
  CHAR\000\
  "

let yyact = [|
  (fun _ -> failwith "parser")
; (fun __caml_parser_env ->
    let _2 = (Parsing.peek_val __caml_parser_env 3 :  Ast.expr) in
    let _4 = (Parsing.peek_val __caml_parser_env 1 :  Ast.expr) in
    Obj.repr(
# 23 "parser.mly"
                                 ( Binop(_2, Add, _4) )
# 214 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _2 = (Parsing.peek_val __caml_parser_env 3 :  Ast.expr) in
    let _4 = (Parsing.peek_val __caml_parser_env 1 :  Ast.expr) in
    Obj.repr(
# 24 "parser.mly"
                                 ( Binop(_2, Sub, _4) )
# 222 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _2 = (Parsing.peek_val __caml_parser_env 3 :  Ast.expr) in
    let _4 = (Parsing.peek_val __caml_parser_env 1 :  Ast.expr) in
    Obj.repr(
# 25 "parser.mly"
                                 ( Binop(_2, Mul, _4) )
# 230 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _2 = (Parsing.peek_val __caml_parser_env 3 :  Ast.expr) in
    let _4 = (Parsing.peek_val __caml_parser_env 1 :  Ast.expr) in
    Obj.repr(
# 26 "parser.mly"
                                 ( Binop(_2, Div, _4) )
# 238 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _2 = (Parsing.peek_val __caml_parser_env 3 :  Ast.expr) in
    let _4 = (Parsing.peek_val __caml_parser_env 1 :  Ast.expr) in
    Obj.repr(
# 27 "parser.mly"
                                  ( FBinop(_2, Fadd, _4) )
# 246 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _2 = (Parsing.peek_val __caml_parser_env 3 :  Ast.expr) in
    let _4 = (Parsing.peek_val __caml_parser_env 1 :  Ast.expr) in
    Obj.repr(
# 28 "parser.mly"
                                  ( FBinop(_2, Fsub, _4) )
# 254 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _2 = (Parsing.peek_val __caml_parser_env 3 :  Ast.expr) in
    let _4 = (Parsing.peek_val __caml_parser_env 1 :  Ast.expr) in
    Obj.repr(
# 29 "parser.mly"
                                  ( FBinop(_2, Fmul, _4) )
# 262 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _2 = (Parsing.peek_val __caml_parser_env 3 :  Ast.expr) in
    let _4 = (Parsing.peek_val __caml_parser_env 1 :  Ast.expr) in
    Obj.repr(
# 30 "parser.mly"
                                  ( FBinop(_2, Fdiv, _4) )
# 270 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _1 = (Parsing.peek_val __caml_parser_env 0 : int) in
    Obj.repr(
# 31 "parser.mly"
                   ( Lit(_1) )
# 277 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _1 = (Parsing.peek_val __caml_parser_env 0 : float) in
    Obj.repr(
# 32 "parser.mly"
                   ( Float(_1))
# 284 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in
    Obj.repr(
# 33 "parser.mly"
                   ( Id(_1))
# 291 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _1 = (Parsing.peek_val __caml_parser_env 0 : char) in
    Obj.repr(
# 34 "parser.mly"
                   ( Char(_1))
# 298 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in
    Obj.repr(
# 35 "parser.mly"
                   ( Str(_1))
# 305 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _1 = (Parsing.peek_val __caml_parser_env 3 : string) in
    let _3 = (Parsing.peek_val __caml_parser_env 1 : 'actuals_opt) in
    Obj.repr(
# 36 "parser.mly"
                               (Call(_1,_3))
# 313 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _2 = (Parsing.peek_val __caml_parser_env 0 : string) in
    Obj.repr(
# 37 "parser.mly"
                   (Int(_2))
# 320 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _2 = (Parsing.peek_val __caml_parser_env 0 : string) in
    Obj.repr(
# 38 "parser.mly"
                   (Flo(_2))
# 327 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _2 = (Parsing.peek_val __caml_parser_env 0 : string) in
    Obj.repr(
# 39 "parser.mly"
                    (Stringv(_2))
# 334 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _1 = (Parsing.peek_val __caml_parser_env 2 : string) in
    let _3 = (Parsing.peek_val __caml_parser_env 0 :  Ast.expr) in
    Obj.repr(
# 40 "parser.mly"
                   (Assign(_1,_3))
# 342 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _2 = (Parsing.peek_val __caml_parser_env 3 : string) in
    let _4 = (Parsing.peek_val __caml_parser_env 1 : int) in
    Obj.repr(
# 41 "parser.mly"
                             (IntArray(_2,_4))
# 350 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _1 = (Parsing.peek_val __caml_parser_env 5 : string) in
    let _3 = (Parsing.peek_val __caml_parser_env 3 : int) in
    let _6 = (Parsing.peek_val __caml_parser_env 0 :  Ast.expr) in
    Obj.repr(
# 42 "parser.mly"
                                     (ArrAssign(_1,_3,_6))
# 359 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _2 = (Parsing.peek_val __caml_parser_env 0 :  Ast.expr) in
    Obj.repr(
# 43 "parser.mly"
                   (Return(_2))
# 366 "parser.ml"
               :  Ast.expr))
; (fun __caml_parser_env ->
    let _1 = (Parsing.peek_val __caml_parser_env 1 :  Ast.expr) in
    Obj.repr(
# 48 "parser.mly"
                   (Expr(_1))
# 373 "parser.ml"
               :  Ast.stmt))
; (fun __caml_parser_env ->
    let _2 = (Parsing.peek_val __caml_parser_env 1 : 'stmt_list) in
    Obj.repr(
# 49 "parser.mly"
                                 (Block(List.rev _2))
# 380 "parser.ml"
               :  Ast.stmt))
; (fun __caml_parser_env ->
    Obj.repr(
# 52 "parser.mly"
                   ([])
# 386 "parser.ml"
               :  Ast.program))
; (fun __caml_parser_env ->
    let _1 = (Parsing.peek_val __caml_parser_env 1 :  Ast.program) in
    let _2 = (Parsing.peek_val __caml_parser_env 0 :  Ast.func) in
    Obj.repr(
# 53 "parser.mly"
                   (_2::_1)
# 394 "parser.ml"
               :  Ast.program))
; (fun __caml_parser_env ->
    let _1 = (Parsing.peek_val __caml_parser_env 6 : string) in
    let _3 = (Parsing.peek_val __caml_parser_env 4 : 'formals_opt) in
    let _6 = (Parsing.peek_val __caml_parser_env 1 : 'stmt_list) in
    Obj.repr(
# 57 "parser.mly"
({ fname=_1; formals=_3; body=Block(List.rev _6); })
# 403 "parser.ml"
               :  Ast.func))
; (fun __caml_parser_env ->
    Obj.repr(
# 60 "parser.mly"
                   ([])
# 409 "parser.ml"
               : 'formals_opt))
; (fun __caml_parser_env ->
    let _1 = (Parsing.peek_val __caml_parser_env 0 : 'formal_list) in
    Obj.repr(
# 61 "parser.mly"
                   (List.rev _1)
# 416 "parser.ml"
               : 'formals_opt))
; (fun __caml_parser_env ->
    let _1 = (Parsing.peek_val __caml_parser_env 0 : 'var) in
    Obj.repr(
# 64 "parser.mly"
                    ([_1])
# 423 "parser.ml"
               : 'formal_list))
; (fun __caml_parser_env ->
    let _1 = (Parsing.peek_val __caml_parser_env 2 : 'formal_list) in
    let _3 = (Parsing.peek_val __caml_parser_env 0 : 'var) in
    Obj.repr(
# 65 "parser.mly"
                        (_3::_1)
# 431 "parser.ml"
               : 'formal_list))
; (fun __caml_parser_env ->
    let _2 = (Parsing.peek_val __caml_parser_env 0 : string) in
    Obj.repr(
# 68 "parser.mly"
                        (_2)
# 438 "parser.ml"
               : 'var))
; (fun __caml_parser_env ->
    let _2 = (Parsing.peek_val __caml_parser_env 0 : string) in
    Obj.repr(
# 69 "parser.mly"
                        (_2)
# 445 "parser.ml"
               : 'var))
; (fun __caml_parser_env ->
    let _2 = (Parsing.peek_val __caml_parser_env 0 : string) in
    Obj.repr(
# 70 "parser.mly"
                        (_2)
# 452 "parser.ml"
               : 'var))
; (fun __caml_parser_env ->
    Obj.repr(
# 74 "parser.mly"
                   ([])
# 458 "parser.ml"
               : 'stmt_list))
; (fun __caml_parser_env ->
    let _1 = (Parsing.peek_val __caml_parser_env 1 : 'stmt_list) in
    let _2 = (Parsing.peek_val __caml_parser_env 0 :  Ast.stmt) in
    Obj.repr(
# 75 "parser.mly"
                    (_2::_1)
# 466 "parser.ml"
               : 'stmt_list))
; (fun __caml_parser_env ->
    let _1 = (Parsing.peek_val __caml_parser_env 0 :  Ast.expr) in
    Obj.repr(
# 78 "parser.mly"
               ([_1])
# 473 "parser.ml"
               : 'actuals_list))
; (fun __caml_parser_env ->
    let _1 = (Parsing.peek_val __caml_parser_env 2 : 'actuals_list) in
    let _3 = (Parsing.peek_val __caml_parser_env 0 :  Ast.expr) in
    Obj.repr(
# 79 "parser.mly"
                          (_3 :: _1)
# 481 "parser.ml"
               : 'actuals_list))
; (fun __caml_parser_env ->
    Obj.repr(
# 82 "parser.mly"
               ([])
# 487 "parser.ml"
               : 'actuals_opt))
; (fun __caml_parser_env ->
    let _1 = (Parsing.peek_val __caml_parser_env 0 : 'actuals_list) in
    Obj.repr(
# 83 "parser.mly"
               (List.rev _1)
# 494 "parser.ml"
               : 'actuals_opt))
(* Entry program *)
; (fun __caml_parser_env -> raise (Parsing.YYexit (Parsing.peek_val __caml_parser_env 0)))
|]
let yytables =
  { Parsing.actions=yyact;
    Parsing.transl_const=yytransl_const;
    Parsing.transl_block=yytransl_block;
    Parsing.lhs=yylhs;
    Parsing.len=yylen;
    Parsing.defred=yydefred;
    Parsing.dgoto=yydgoto;
    Parsing.sindex=yysindex;
    Parsing.rindex=yyrindex;
    Parsing.gindex=yygindex;
    Parsing.tablesize=yytablesize;
    Parsing.table=yytable;
    Parsing.check=yycheck;
    Parsing.error_function=parse_error;
    Parsing.names_const=yynames_const;
    Parsing.names_block=yynames_block }
let program (lexfun : Lexing.lexbuf -> token) (lexbuf : Lexing.lexbuf) =
   (Parsing.yyparse yytables 1 lexfun lexbuf :  Ast.program)
